<?php
/**
 * Created by PhpStorm.
 * User: longli
 * Date: 2022/02/18
 * Time: 11:33
 * @link http://www.lmterp.cn
 */

namespace app\common\service\export;


/**
 * 导出产品
 * Class ProductDevelop
 * @package app\common\service\export
 */
class ProductDevelop extends BaseExport
{

    public function getheader()
    {
        $fields = \app\common\model\ProductDevelop::getTableFields();
        $fields = array_slice($fields, 1, 30);
        $fields[] = "create_time";
        return $fields;
    }

    public function getData($condition = [])
    {
        $first = [
            "develop_manager" => "产品经理",
            "goods_name" => "品名",
            "checked_belone" => "已选账号",
            "advice_belone" => "已选账号",
            "goods_img" => "图片",
            "keywords" => "关键词",
            "rating" => "平均rating",
            "category" => "类目",
            "market_analysis" => "市场需求分析",
            "competitor_analysis" => "竞争对手分析",
            "badreview_analysis" => "差评分析",
            "goods_des" => "开发及选品(描述)",
            "goods_link" => "产品链接",
            "distributor" => "供应商",
            "distributor_phone" => "供应商联系方式",
            "nationality" => "国家",
            "price" => "产品价格",
            "brokerage" => "FBA佣金",
            "commission" => "FBA操作费",
            "exchange_rate" => "美元汇率",
            "weight" => "重量",
            "air_freight" => "空运价格",
            "sea_freight" => "海运价格",
            "expected_purchase_price" => "目标采购价",
            "air_freight_profits" => "空运利润",
            "sea_freight_profits" => "海运利润",
            "air_freight_profits_rate" => "空运利率",
            "sea_freightprofits_rate" => "海运利率",
            "goods_ramark" => "产品参数及特点",
            "sales_ramark" => "销售人员意见",
            "create_time" => "录入时间"
        ];
        $field = $this->getheader();
        $data = \app\common\model\ProductDevelop::field($field)->where($condition)->select()->toArray();
        array_unshift($data, $first);
        return $data;
    }
}